home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- #-----------------------------------------------------------------------------
- # Tidy V1.0 Installation Utility
- # COPYRIGHT (C) 1996 Marek Rouchal
- #
- # Please check this file and specify the paths where you want the tidy files
- #-----------------------------------------------------------------------------
-
- # do not install when perl is < v5
- require 5.0;
-
- # ----------------------------------------------------------------------------
- # Edit this paths!!
- #-----------------------------------------------------------------------------
-
- # Where to put the tidy executable script
- $EXEC_PATH = "/usr/sbin";
-
- # Where to put manpages
- $MAN5_PATH = "/usr/man/man5";
- $MAN8_PATH = "/usr/man/man8";
-
- # Where to put the default config file
- # `canonical' locations are /var/adm or /etc
- $CFG_PATH = "/var/adm";
-
- # ----------------------------------------------------------------------------
- # Commands used for installation
-
- $INSTALLBIN = "install -c -m 750"; # mode rwxr-x---
- $INSTALLDOC = "install -c -m 644"; # mode rw-r--r--
-
- # ----------------------------------------------------------------------------
- # You should not have to edit anything below
- #-----------------------------------------------------------------------------
-
- # Install everything
- print "Installing path to configfile in tidy main script...\n";
- &install_cfg_path;
- print "Installing tidy in $EXEC_PATH...\n";
- `$INSTALLBIN tidy $EXEC_PATH/tidy`;
- print "Installing tidy.8 in $MAN8_PATH...\n";
- `$INSTALLDOC tidy.8 $MAN8_PATH/tidy.8`;
- print "Installing tidy.5 in $MAN5_PATH...\n";
- `$INSTALLDOC tidy.conf.5 $MAN5_PATH/tidy.conf.5`;
- print "Installing tidy.conf in $CFG_PATH...\n";
- `$INSTALLDOC tidy.conf $CFG_PATH/tidy.conf`;
- print "Done.\n";
- exit 0;
-
- # This is taken from latex2html/install-test (modified).
- sub install_cfg_path {
- local( $ok ) = 0;
- if ( ( -f "tidy" ) || die "Cannot find tidy.\n" ) {
- open( IN, "<tidy" ) || die "Cannot open tidy\n";
- rename( "tidy", "tidy.bak" );
- open(OUT, ">tidy") || die "Cannot open tidy for output\n";
- chmod 0755, "tidy";
- while ( <IN> ) {
- if ( /^\s*\$CONFIGFILE\s*=.*$/ ) {
- $SUCCESS = 1;
- print OUT "\$CONFIGFILE = \"$CFG_PATH/tidy.conf\";\n";
- }
- else
- { print OUT $_; }
- }
- close IN;
- close OUT;
- }
- if ($SUCCESS) {
- print "Successfully installed path to config file in main script.\n";
- }
- else {
- die "Installation of default path to config file in main script failed.\n";
- }
- }
-
-